package me.leiusual.sharing.api.model

/**
 * author: leiusual
 * create on: 2019-07-27
 * description:
 */
data class ProductDetail(
    val currentQuantity: Int, // 当前型号商品的库存数量
    val referStoreId: Long?, // 推广店铺编号
    val optionList: List<Option>, // 商品所有的属性类型和对应的属性值列表
    val product: Product, // 商品信息
    val store: Store,
    val storeArea: Area, // 店区信息
    val defaultMia: Mia,
    val productModelName: String?,
    val inventory: Int, // 上架数量，最大库存
    val skus: List<Sku>, // 当前商品对应店区内所有的上架信息
    val currentSku: Map<Long, Long>, // 当前上架型号的属性，<属性名编号，属性值编号>
    val allMia: List<Mia>,
    val allArea: List<Area>,
    val pictures: List<Picture>,
    val originPrice: String, // 原价
    val validPrice: PricePoints, // 商品价格描述对象
    val validPoints: PricePoints, // 商品价格描述对象
    val inPurchase: Boolean, // 是否是批发店区
    val inDiscount: Boolean, // 是否是折扣店区
    val params: List<Params>, // 商品参数列表
    val canBuy: Boolean, // 当前能够购买
    val intervalDaysMsg: String // 购买间隔信息
) {

  // 商品属性类型
  data class Option(
      val id: Long, // 属性编号
      val name: String, // 属性名称
      val productOptionValues: List<OptionValue>, // 属性下拥有的属性值列表
      val sort: Int
  ) {

    // 商品属性可选值
    data class OptionValue(
        val id: Long, // 属性值编号
        val value: String, // 具体的属性的值
        val sort: Int
    ) {

      var checked = false

      var enabled = true
    }
  }

  data class Product(
      val id: Int,
      val name: String, // 商品名称
      val shortName: String, // 短名称
      val code: String, // 商品编码
      val picture: String, // 默认图片
      val detail: String, // 商品描述，富文本
      val soldCount: Int, // 已售数量
      val priceRange: String?, // 售价范围
      val productType: String, // COMMON, RECHARGE_CARD, BUSINESS_CARD
      val accountType: String?, // CASH, COMMISSION, PLATFORM_COMMISSION, CREDIT_COIN, POINT_COIN, EXCHANGE_COIN, CASH_COIN
      val originPrice: Double // 原价
  )

  data class Store(
      val id: Long,
      val name: String,
      val pinYinAbbreviate: String,
      val firstLetter: String,
      val code: String,
      val levelId: Int,
      val levelName: String,
      val levelCode: String,
      val logoUrl: String,
      val hosts: List<Any>,
      val storeStatus: String,
      val storeType: String,
      val businessTypes: List<String>,
      val enableMultiArea: Boolean,
      val searchKeys: Any?,
      val province: Province,
      val city: City,
      val county: County,
      val detailAddress: String,
      val sort: Int,
      val introduction: String,
      val content: String?,
      val qq: String,
      val enableInvoice: Boolean,
      val workMode: String,
      val changeNameTime: String,
      val inviteCode: String
  ) {

    data class County(
        val id: Int,
        val name: String,
        val fullName: String,
        val level: String
    )

    data class Province(
        val id: Int,
        val name: String,
        val fullName: String,
        val level: String
    )

    data class City(
        val id: Int,
        val name: String,
        val fullName: String,
        val level: String
    )
  }

  data class Area(
      val id: Int,
      val name: String,
      val storeAreaType: String,
      val sort: Int,
      val defaultArea: Boolean,
      val enableCombine: Boolean,
      val enableQuery: Boolean,
      val enableDropping: Boolean,
      val commissionRatio: Double,
      val bindingAccountType: String?,
      val minUserLevel: String,
      val intMinUserLevel: Int
  )

  data class Mia(
      val id: Long,
      val name: String,
      val coinAmount: Double,
      val coinType: String,
      val creditPoints: Double,
      val pointCoins: Double,
      val purchasePrice: Double,
      val unifiedRetailPrice: Double,
      val sellingCount: Int,
      val sort: Int,
      val enableModify: Boolean,
      val minPurchaseAmount: Int,
      val maxAmount: Long?,
      val independentFreight: Double,
      val profits: List<Any>,
      val minBusinessLevel: Any?,
      val businessLevel: Any?,
      val forcePromotion: Boolean,
      val promotionScope: String,
      val businessType: String?
  )

  data class Sku(
      val miaId: Long, // 上架记录编号
      val modelId: Int, // 型号编号
      val originAmount: Double, // 原价
      val coinAmount: Double, // 币数量？
      val pointCoins: Double, // 币值额度?
      val purchasePrice: Int, // 批发价
      val unifiedRetailPrice: Int, // 统一零售价
      val pointCoinFlag: String, // 积分比标志
      val stock: Int, // 库存
      val sku: Map<Long, Long>, // 属性名值映射，<属性名编号：属性值编号>
      val minPurchaseAmount: Int, // 最小购买数量
      val amountInCart: Int // 当前型号在购物车内已有的数量，当前购买量加购物车内数量不能小于最小购买量
  )

  data class Picture(
      val url: String,
      val name: String
  )

  data class PricePoints(
      val priceType: String?, // 价格类型 RETAIL, FREIGHT, COIN, PURCHASE, UNIFIED_RETAIL
      val coinType: String?, // 币类型 RMB, JFB
      val flag: String?, // 币符号
      val accountType: String?, // 币账户类型 CASH, COMMISSION, PLATFORM_COMMISSION, CREDIT_COIN, POINT_COIN, EXCHANGE_COIN, CASH_COIN
      val accountTypeName: String?, // 币账户类型名称
      val pointCoin: Double, // 币值额度
      val pointCoinString: String? // 币值额度字符串
  )

  data class Params(
      val name: String,
      val optionType: String,
      val value: String
  )
}